package practise.mulitThreads.ChefAndWaiter;

import java.util.concurrent.Callable;

/**
 * Created by richard on 4/27/14.
 */
public class Waiter implements Callable<Order> {
    private String name ;

    public Order getOrder() {
        return order;
    }

    public void setOrder(Order order) {
        this.order = order;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    private Order order;
    private  static final int DELIVER_TIME=2000;

    @Override
    public Order call() throws Exception {
        resturant.deliverADinner(this);
        deliverDinner();
        return getOrder();
    }

    public void deliverDinner() throws InterruptedException {
        Thread.sleep(DELIVER_TIME);
    }
    private Resturant resturant;
    public Resturant getResturant() {
        return resturant;
    }

    public void setResturant(Resturant resturant) {

        this.resturant = resturant;
    }
}
